﻿<%@ Page Language="C#" MasterPageFile="~/main.Master" AutoEventWireup="true" CodeBehind="showArticle.aspx.cs"
    Inherits="PreguntaAlExperto.showArticle" EnableTheming="true" Theme="mainTheme"
    ValidateRequest="false" %>

<%@ Register Src="Components/LogIn.ascx" TagName="LogIn" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style>
        h1, h2, h3
        {
            color: #006699;
        }
        h1, h4
        {
            font-size: 16px;
        }
        h2, h5
        {
            font-size: 14px;
        }
        h3, h6
        {
            font-size: 12px;
        }
        h4, h5, h6
        {
            color: #FF6600;
        }
    </style>
    <script type="text/javascript" language="javascript" src="/script/addto.js"></script>
    <script language="javascript" type="text/javascript">
    var _totalShine = <TotalShine>;
    var _URL = "<RequestedURL>";
    var _blink = 0;
    var _voted = false;
    var _totalVotes = <TotalVotes>;

    function DrawStars()
    {
        for(i = 0; i < _totalShine; i++)
            document.write("<img style=\"cursor:pointer;\" src=\"/images/miniBrainOn.jpg\" width=\"16\" height=\"16\" id=\"img_" + i + "\" alt=\"" + (i + 1) + "\" onclick=\"SendVote('" + (i + 1) + "');\">");

        for(i = _totalShine; i < 5; i++)
            document.write("<img style=\"cursor:pointer;\" src=\"/images/miniBrainOff.jpg\" width=\"16\" height=\"16\" id=\"img_" + i + "\" alt=\"" + (i + 1) + "\" onclick=\"SendVote('" + (i + 1) + "');\">");

        document.write("<br><span id='id_votes'>" + _totalVotes + "</span> Votos");
    }

    function SendVote(_points)
    {
        if(!_voted)
        {
            _blink = 0;
            var _AjaxHandler = new AjaxHandler("/updateVotes.aspx?Points=" + _points + "&URL=" + _URL, CaptureResponse);
            _AjaxHandler.SendRequest();
            _voted = true;
        }
    }

    function CaptureResponse(_value)
    {
        _totalVotes = _value.split(',')[1];
        _value =  _value.split(',')[0];

        if (document.all)
            document.getElementById('id_votes').innerText = _totalVotes;
            else
            document.getElementById('id_votes').textContent = _totalVotes;

        for(i = 0; i < _value; i++)
        {
            var _img = document.getElementById("img_" + i);
            _img.src = "/images/miniBrainOn.jpg";
        }

        for(i = _value; i < 5; i++)
        {
            var _img = document.getElementById("img_" + i);
            _img.src = "/images/miniBrainOff.jpg";
        }
        setTimeout('DoBlink(' + (_value - 1) + ')', 500);
    }

    function DoBlink(_value)
    {
        var _img = document.getElementById("img_" + _value);
        if (_img.src.indexOf("miniBrainOn.jpg") != -1)
            _img.src = "/images/miniBrainOff.jpg";
        else
            _img.src = "/images/miniBrainOn.jpg";

        _blink++;
        if (_blink <=3)
            setTimeout('DoBlink(' + _value + ')', 500);
    }
    
    function ShowLoginContainer()
    {
        document.getElementById("UnloggedPanelText").style.display = "none";
        document.getElementById("UnloggedPanelLogin").style.display = "";
    }
    
    function GetInformation()
    {
        document.getElementById("CheckLoading").style.display = "";
        document.getElementById("CheckComment").style.display = "none";
        var _AjaxHandler = new AjaxHandler("/KeepMeInform.aspx?URL=" + _URL + "&ST=", MarkInfo);
        _AjaxHandler.SendRequest();
    }
    
    function SetInformation()
    {
        document.getElementById("CheckLoading").style.display = "";
        document.getElementById("CheckComment").style.display = "none";
        var _check = document.getElementById("KeepMeInform");
        var _AjaxHandler = new AjaxHandler("/KeepMeInform.aspx?URL=" + _URL + "&ST=" + (_check.checked ? "1" : "0"), MarkInfo);
        _AjaxHandler.SendRequest();    
    }
    
    function MarkInfo(value)
    {
        var _check = document.getElementById("KeepMeInform");
        var _imgFollow = document.getElementById("imgFollow");
        if (value != "0")
        {
            _imgFollow.src = "/images/follow.gif";
            _check.checked = true;
            
        }
        else
        {
            _imgFollow.src = "/images/unchecked.gif";
            _check.checked = false;
        }
        setTimeout("ShowCheck()",1000);
    }
    
    function ShowCheck()
    {
        document.getElementById("CheckLoading").style.display = "none";
        document.getElementById("CheckComment").style.display = "";
    }
    
    function KeepMeInformButton()
    {
        var _check = document.getElementById("KeepMeInform");
        _check.checked = !_check.checked;
        setTimeout("SetInformation()",1000);        
    }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="body" style="padding-right: 20px; padding-bottom: 30px;">
        <table width="100%" border="0">
            <tr>
                <td width="80%" valign="top">
                    <table border="0">
                        <tr>
                            <td>
                                <span style="font-size: 20px; font-weight: bold;"><a name="Inicio"></a>
                                    <articletitle>
                                </span>
                            </td>
                        </tr>
                        <!-- Proximamente estará disponible -->
                        <tr>
                            <td>
                                <div class="SmallFontSize">
                                    <!--img src="/Images/print.ico" width="16" height="16" alt="Imprimir" style="vertical-align: middle" />
                                    <a href="#">Imprimir</a> &nbsp;
                                    <img src="/Images/report.ico" width="16" height="16" alt="Reportar artículo" style="vertical-align: middle" />
                                    <a href="#">Reportar artículo</a> &nbsp;-->
                                    <span id="followicon" runat="server"><img src="/images/follow.gif" id="imgFollow" alt="Marcar para comentarios" onclick="KeepMeInformButton(); return false;" style="cursor:pointer; vertical-align: middle;" />
                                    <a href="#" onclick="KeepMeInformButton(); return false;">Seguir</a>&nbsp;&nbsp;&nbsp;</span>
                                    <!--img src="/Images/link.png" width="16" height="16" alt="Marcar" style="vertical-align: middle;" />
                                    <a href="#" onclick="return bookmarkMe(5371, 2);">Marcar</a>&nbsp;-->
                                    <a href="#comments"><img src="/images/comment.gif" alt="Comentar este artículo" border="0" style="cursor:pointer; vertical-align: middle" />
                                    Comentar</a>&nbsp;&nbsp;&nbsp;
                                    <a href="mailto:?Subject=Hola, te recomiento el siguiente artículo&Body=Te recomiento este artículo de PreguntaAlExperto.net: http://www.preguntaalexperto.net/articles/<RequestedURL>">
                                    <img src="/images/sendmail.gif" alt="Recomendar este artículo" border="0" style="cursor:pointer; vertical-align: middle" /> 
                                    Recomendar este artículo</a>
                                </div>
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 580px;">
                                <contextreplace></contextreplace>
                            </td>
                        </tr>
                        <tr>
                            <td><br />
                                <a href="#Inicio">
                                    <img alt="Ir al principio" src="/images/goup.gif" style="border: 0px; vertical-align: middle;" />&nbsp;Inicio del artículo</a>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            <br />
                                <span style="font-size: 11px; font-family: Arial;">
                                    <autorinformation>
                                </span>
                            <br /><br />
                            <script language="JavaScript" type="text/javascript">
                            var socialLinks = new social();
                            socialLinks.addtoMethod=1;
                            socialLinks.DrawLinks("socialLinks", document.location.href, escape(document.title), 100, 0);
                            </script>
                            <br /><br />
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 580px;">
                                <a name="comments"></a><i><b>Comentarios:</b></i><br />
                                <div style="padding: 15px 0px 0px 15px">
                                    <comments>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
                <td valign="top" align="right" rowspan="2">
                    <table>
                        <tr>
                            <td>
                                <div style="text-align: right; margin-right: 30px;">
                                    <div style="padding-top: 3px; width: 90px; text-align: center; font-family: Arial;
                                        font-size: 8px; border: solid 1px;">

                                        <script type="text/javascript">
            DrawStars();
                                        </script>

                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <br />
                    <relatedContent></relatedContent>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                               <!-- Ads -->
                               <script type="text/javascript"><!--
                                    google_ad_client = "pub-0764539371667310";
                                    /* 160x600, created 9/30/08 */
                                    google_ad_slot = "1997924801";
                                    google_ad_width = 160;
                                    google_ad_height = 600;
                                    //-->
                                </script>
                            <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <a name="#comments"></a>
                    <asp:Panel ID="pnlMustLoggedToComment" runat="server">
                        <div class="UnloggedPanelComment" style="padding: 2px 2px 2px 2px;">
                            <div id="UnloggedPanelText">
                                Para poder comentar el artículo es necesario que te registres como usuario.
                                <br>
                                Si aún no eres un usuario registrado puedes hacerlo por medio del siguiente <a href="/registrarse.aspx">
                                    link</a>.
                                <br>
                                <br>
                                Si ya eres un usuario registrado simplemente autentifícate para poder comentar el
                                artículo.<br>
                                Para autentificarte como usuario puedes hacerlo por medio del siguiente <a href="#"
                                    onclick="ShowLoginContainer(); return false;">link</a>.
                            </div>
                            <div id="UnloggedPanelLogin" style="display: none;">
                                <uc1:LogIn ID="LogIn1" runat="server" LitteMode="True" />
                            </div>
                        </div>
                    </asp:Panel>
                    <asp:Panel ID="pnlCommentAction" runat="server">
                        <br />
                        <div id="CheckComment">
                            <input type="checkbox" id="KeepMeInform" onclick="SetInformation();" />
                            Mantenerme informado de nuevos comentarios realizados a este artículo.
                        </div>
                        <div id="CheckLoading" style="display: none; font-size: 16px; font-weight: bolder;">
                            Procesando...</div>
                        <br />
                        Comentario:<br />
                        <asp:TextBox ID="txtComment" TextMode="MultiLine" Rows="9" Columns="40" runat="server"></asp:TextBox>
                        <br />
                        <asp:Button ID="btnComment" runat="server" Text="Comentar" OnClick="btnComment_Click" />
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
